Skip to content

Conversation

@tareknaser
Copy link

This PR extracts the SMT solving functionality from the codebase into a standalone leafsolver crate. The new crate provides both a library interface and a CLI binary

The solver currently re-exports Constraint from the common crate

Copy link
Contributor

@momvart momvart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort.

An important missing piece:
As I mentioned before, except sanity checking, we will negate some constraints to derive a new input. Currently, we don't have any mechanism for that. Although implementing it will be done by supporting a view on the query, for now we can have an option to negate the last constraint as a minimum.

Beside that, things look fine for now. I'll rebase to your branch and use your binary for actual solving.

Comment on lines +68 to +76
match output.result.as_str() {
"sat" => println!(
"✓ SAT - Solution found and written to {}",
args.output.display()
),
"unsat" => println!("✗ UNSAT - No solution exists"),
"unknown" => println!("? UNKNOWN - Could not determine satisfiability"),
_ => unreachable!("Unexpected result: {}", output.result),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use macros in common:logging for logging.


let constraint_value = json_value
.as_object_mut()
.and_then(|obj| obj.remove("constraint"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you use consts for these stuff.

/// Input format for JSONL constraint files
#[derive(Debug, Serialize, Deserialize)]
pub struct ConstraintEntry {
pub step: StepInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you still have step here


// Serialization support for binary interface
#[cfg(feature = "serde")]
pub mod format {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this format only concerns the binary, I'd like it out of the library but in the binary's module

}

#[test]
fn test_constraint_kind_operations() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing the tests. I see some of them are focused on common's data structures. Why not moving them there next to their definitions?

@momvart momvart changed the title Decouple Solver Component into Standalone Crate #547 Decouple Solver Component into Standalone Crate Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants